package hu.szyrt.bug.models;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.nirigo.mobile.googledirectionapi.MapUtils;

import android.location.Location;

public class PlaceItem extends PlaceItemBase {

	private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	
	private String openingHour;
	private String telephone;
	private String website;
	private String address;

	private String imageMap;
	private String image1, image2;
	private int tourID, tourNumber;
	
	private String modifyDate;
		
	private int discountValue;	
	private String discountDescription;
	private int discountsNumber; // number_of_discount
	private String discountStart, 
				   discountEnd;
	private Date discountStartDate,
				 discountEndDate;
	private String discountModifyDate;
	private int discountRemainingNumber; //place_number_of_discount_remaining
	
	private double latitude, 
				   longitude;
	
	
	public PlaceItem(int id, String name, String description, String imagePolaroid, 
			int highlightsNumber, int discountType,
			String openingHour, String telephone, String website,
			String address, String imageMap, String image1, String image2,
			int tourID, int tourNumber, String modifyDate, 
			int discountValue, String discountDescription, int discountsNumber,
			String discountStart, String discountEnd,
			String discountModifyDate, int discountRemainingNumber, 
			double latitude, double longitude) throws ParseException {
		
		super(id, name, description, imagePolaroid, highlightsNumber, discountType);
		
		this.openingHour = openingHour;
		this.telephone = telephone;
		this.website = website;
		this.address = address;
		this.imageMap = imageMap;
		this.image1 = image1;
		this.image2 = image2;
		this.tourID = tourID;
		this.tourNumber = tourNumber;
		this.modifyDate = modifyDate;
		this.discountValue = discountValue;
		this.discountDescription = discountDescription;
		this.discountsNumber = discountsNumber;
		this.discountStart = discountStart;
		if(discountStart != null && !discountStart.equals("(null)"))
			this.discountStartDate = sdf.parse(discountStart);
		this.discountEnd = discountEnd;
		if(discountEnd != null && !discountStart.equals("(null)"))			
			this.discountEndDate = sdf.parse(discountEnd);
		this.discountModifyDate = discountModifyDate;
		this.discountRemainingNumber = discountRemainingNumber;
		this.latitude = latitude;
		this.longitude = longitude;
	}


	public String getOpeningHour() {
		return openingHour;
	}


	public String getTelephone() {
		return telephone;
	}


	public String getWebsite() {
		return website;
	}


	public String getAddress() {
		return address;
	}


	public String getImageMap() {
		return imageMap;
	}


	public String getImage1() {
		return image1;
	}


	public String getImage2() {
		return image2;
	}


	public int getTourID() {
		return tourID;
	}


	public int getTourNumber() {
		return tourNumber;
	}


	public String getModifyDate() {
		return modifyDate;
	}


	public int getDiscountValue() {
		return discountValue;
	}


	public String getDiscountDescription() {
		return discountDescription;
	}


	public int getDiscountsNumber() {
		return discountsNumber;
	}


	public String getDiscountStart() {
		return discountStart;
	}
	
	public Date getDiscountStartDate() {
		return discountStartDate;
	}
		
	public String getDiscountEnd() {
		return discountEnd;
	}
	
	public Date getDiscountEndDate() {
		return discountEndDate;
	}


	public String getDiscountModifyDate() {
		return discountModifyDate;
	}


	public int getDiscountRemainingNumber() {
		return discountRemainingNumber;
	}
	
	public double getLatitude() {
		return latitude;
	}
	
	public double getLongitude() {
		return longitude;
	}
	
	public Location getLocation(){
		return MapUtils.toLocation(latitude, longitude);
	}

}
